#!/bin/bash

# 鼎红云屏项目 Docker 镜像构建脚本
# 用于 Minikube 部署

set -e

echo "开始构建鼎红云屏项目 Docker 镜像..."

# 获取项目根目录
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
echo "项目根目录: $PROJECT_ROOT"

# 构建后端镜像
echo "构建后端镜像..."
cd "$PROJECT_ROOT/server"
docker build -t dinghong-cloud-screen-server:latest .

# 构建前端镜像
echo "构建前端镜像..."
cd "$PROJECT_ROOT/web"
docker build -t dinghong-cloud-screen-web:latest .

# 将镜像加载到 Minikube
echo "将镜像加载到 Minikube..."
minikube image load dinghong-cloud-screen-server:latest
minikube image load dinghong-cloud-screen-web:latest

echo "镜像构建完成！"
echo "后端镜像: dinghong-cloud-screen-server:latest"
echo "前端镜像: dinghong-cloud-screen-web:latest"

minikube tunnel 